proc maskhost {uhost} {
	regexp {([^!]+)!([^@]+)@(.+)} $uhost -> nick user host

	set count [string length $host]
	set ncount [string length [string map { "." "" } $host]]
	set dots [expr $count - $ncount]

	switch -- $dots {
		0 - 1 {
			set mask "*!$user@$host"
		}

		default {
			regexp {[^\.]+\.(.+)} $host -> domain
			set mask "*!$user@*.$domain"
		}
	}

	return $mask
}
